import java.util.Arrays;
import java.util.TooManyListenersException;

public class Test03 {
    public static  int[] searchRange(int[] nums, int target) {

        int t = -1;
        int left = 0;
        int right = nums.length-1;
        int[] arr = new int[]{-1,-1};
        while(left<=right){
            int mid = left + (right-left)/2;
            if(nums[mid]<target){
                left = mid+1;
            }else if(nums[mid]>target){
                right=mid+1;
            }else{
                t = mid;
                right = mid-1;
            }
        }
        if(t==-1){
            return arr;
        }
        arr[0] = t;
        left = t+1;
        right = nums.length-1;
        t = -1;
        while(left<=right){
            int mid = left + (right-left)/2;
            if(nums[mid]<target){
                left = mid+1;
            }else if(nums[mid]>target){
                right=mid-1;
            }else{
                t = mid;
                left = mid+1;
            }
        }
        arr[1] = t;
        return arr;
    }

    public static void main(String[] args) {
        int[] nums = new int[0];
        int a= 10;
Math.sqrt(a);
        int[] arr = searchRange(nums,0);
        System.out.println(Arrays.toString(arr));
    }
}
